import { useLocation, Navigate } from 'react-router-dom';

function AuthRouter(props) {
  const token = '1';
  const { pathname } = useLocation();
  if (pathname === '/login') {
    return props.children;
  }
  if (!token) {
    return <Navigate to="/login" />;
  } else {
    return props.children;
  }
}
export default AuthRouter;
